package com.itheima.config;

import com.itheima.Interceptor.JWTInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorConfig extends WebMvcConfigurationSupport {
    @Autowired
    private JWTInterceptor JWTInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //配置拦截器拦截路径
        System.out.println("-----------------------------");


        registry.addInterceptor(JWTInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/employee/login","/employee");
    }

}
